﻿using System;
using System.Diagnostics;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YJKArch.NumberRoom
{
	[Transaction(TransactionMode.Manual)]
	internal class CmdRoomNameSearchReplace : IExternalCommand
	{
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
		{
			if (CmdRoomNameSearchReplace._hWndRevit == null)
			{
				CmdRoomNameSearchReplace._hWndRevit = new WindowHandle(Process.GetCurrentProcess().MainWindowHandle);
			}
			try
			{
				CmdRoomNameSearchReplace._roomNameMag = new RoomNameSelReplaceManager(commandData);
				CmdRoomNameSearchReplace._roomNameMag.ModifyRoomTag();
			}
			catch (Exception)
			{
			}
			return Autodesk.Revit.UI.Result.Succeeded;
		}

		public static WindowHandle _hWndRevit;

		public static RoomNameSelReplaceManager _roomNameMag;
	}
}
